﻿# Would an agent join a scheme to do something like seduce the target?
ai_agent_join_chance_hostile_taboo_modifier = {
	ai_agent_join_chance_hostile_general_suite_modifier = yes

	# Opinion
	## How much does the Agent like the Target? Modified by ai_honor
	### Positive honor multiplier: Ranges -1 to -5
	### Negative honor multiplier: Ranges -1 to -0.2
	### Then multiplied by 1.5
	opinion_modifier = {
		trigger = {
			NOT = { this = scope:target }
			opinion = {
				target = scope:target
				value >= low_positive_opinion
			}
		}
		who = this
		opinion_target = scope:target
		multiplier = {
			value = -1
			if = {
				limit = { this.ai_honor >= 0 }
				subtract = {
					value = this.ai_honor
					multiply = 0.025
				}
			}
			else = {
				subtract = {
					value = this.ai_honor
					multiply = 0.008
				}
			}
			multiply = 1.5
		}
		desc = SCHEME_MY_OPINION_OF_TARGET
	}
	# Faith
	## Stance on your adultery.
	### Shunned.
	modifier = {
		trigger = {
			NOR = {
				has_trait = cynical
				scope:owner = { is_spouse_of = scope:target }
				AND = {
					hp_accepts_concubinage = yes
					OR = {
						scope:owner = { is_concubine_of = scope:target }
						scope:target = { is_concubine_of = scope:owner }
					}
				}
			}
			OR = {
				AND = {
					scope:owner = { is_male = yes }
					faith = { has_doctrine_parameter = adultery_male_crime }
				}
				AND = {
					scope:owner = { is_female = yes }
					faith = { has_doctrine_parameter = adultery_female_crime }
				}
			}
		}
		add = -5
		desc = ai_opinion.reason.faith.adultery_shunned.owner
	}
	### Criminal.
	modifier = {
		trigger = {
			NOR = {
				has_trait = cynical
				scope:owner = { is_spouse_of = scope:target }
				AND = {
					hp_accepts_concubinage = yes
					OR = {
						scope:owner = { is_concubine_of = scope:target }
						scope:target = { is_concubine_of = scope:owner }
					}
				}
			}
			OR = {
				AND = {
					scope:owner = { is_male = yes }
					faith = { has_doctrine_parameter = adultery_male_crime }
				}
				AND = {
					scope:owner = { is_female = yes }
					faith = { has_doctrine_parameter = adultery_female_crime }
				}
			}
		}
		add = -15
		desc = ai_opinion.reason.faith.adultery_criminal.owner
	}
	## Stance on their adultery.
	### Shunned.
	modifier = {
		trigger = {
			NOR = {
				has_trait = cynical
				scope:owner = { is_spouse_of = scope:target }
				AND = {
					hp_accepts_concubinage = yes
					OR = {
						scope:owner = { is_concubine_of = scope:target }
						scope:target = { is_concubine_of = scope:owner }
					}
				}
			}
			OR = {
				AND = {
					scope:owner = { is_male = yes }
					faith = { has_doctrine_parameter = adultery_male_crime }
				}
				AND = {
					scope:owner = { is_female = yes }
					faith = { has_doctrine_parameter = adultery_female_crime }
				}
			}
		}
		add = -5
		desc = ai_opinion.reason.faith.adultery_shunned.target
	}
	### Criminal.
	modifier = {
		trigger = {
			NOR = {
				has_trait = cynical
				scope:owner = { is_spouse_of = scope:target }
				AND = {
					hp_accepts_concubinage = yes
					OR = {
						scope:owner = { is_concubine_of = scope:target }
						scope:target = { is_concubine_of = scope:owner }
					}
				}
			}
			OR = {
				AND = {
					scope:owner = { is_male = yes }
					faith = { has_doctrine_parameter = adultery_male_crime }
				}
				AND = {
					scope:owner = { is_female = yes }
					faith = { has_doctrine_parameter = adultery_female_crime }
				}
			}
		}
		add = -15
		desc = ai_opinion.reason.faith.adultery_criminal.target
	}
	## Lust is a sin.
	modifier = {
		trigger = {
			faith = { trait_is_sin = lustful }
		}
		add = -5
		desc = ai_opinion.reason.trait_is_sinful.lustful
	}
	## Lust is a virtue.
	modifier = {
		trigger = {
			faith = { trait_is_virtue = lustful }
		}
		add = 10
		desc = ai_opinion.reason.trait_is_virtuous.lustful
	}
	## Chaste is a sin.
	modifier = {
		trigger = {
			faith = { trait_is_sin = chaste }
		}
		add = 10
		desc = ai_opinion.reason.trait_is_sinful.chaste
	}
	## Chaste is a virtue.
	modifier = {
		trigger = {
			faith = { trait_is_virtue = chaste }
		}
		add = -5
		desc = ai_opinion.reason.trait_is_virtuous.chaste
	}
	# AI Personality
	## Compassion (general)
	modifier = {
		trigger = {
			ai_compassion > 0
			NOT = { this = scope:target }
		}
		add = {
			value = ai_compassion
			multiply = -1
			divide = 2.5
		}
		desc = COMPASSIONATE_REASON
	}
	## Compassion (sadism)
	modifier = {
		trigger = {
			ai_compassion < high_negative_ai_value
			NOT = { this = scope:target }
		}
		add = {
			value = ai_compassion
			multiply = -1
			divide = 10
		}
		desc = COMPASSIONATE_NEGATIVE_REASON
	}
	## Vengefulness (and the prospective agent has been wronged by scope:target)
	modifier = {
		trigger = {
			ai_vengefulness > 0
			NOT = { this = scope:target }
			opinion = {
				target = scope:target
				value <= 0
			}
			OR = {
				has_opinion_modifier = {
					modifier = murdered_close_family_crime
					target = scope:target
				}
				has_opinion_modifier = {
					modifier = attempted_murder_close_family_crime
					target = scope:target
				}
				has_opinion_modifier = {
					modifier = executed_close_family
					target = scope:target
				}
				has_opinion_modifier = {
					modifier = slept_with_spouse_discovered_opinion
					target = scope:target
				}
				has_opinion_modifier = {
					modifier = slept_with_spouse_exposed_opinion
					target = scope:target
				}
				has_opinion_modifier = {
					modifier = unfaithful_spouse_discovered_opinion
					target = scope:target
				}
				has_opinion_modifier = {
					modifier = unfaithful_spouse_exposed_opinion
					target = scope:target
				}
				has_opinion_modifier = {
					modifier = refused_to_renounce_lover_opinion
					target = scope:target
				}
				has_opinion_modifier = {
					modifier = betrayed_our_promise
					target = scope:target
				}
				has_opinion_modifier = {
					modifier = botched_my_treatment_crime_opinion
					target = scope:target
				}
				has_opinion_modifier = {
					modifier = botched_treatment_of_kin_crime_opinion
					target = scope:target
				}
				has_opinion_modifier = {
					modifier = smeared_opinion
					target = scope:target
				}
				has_opinion_modifier = {
					modifier = insulted_opinion
					target = scope:target
				}
				has_opinion_modifier = {
					modifier = mocked_me_in_time_of_need
					target = scope:target
				}
				has_opinion_modifier = {
					modifier = loved_one_dungeon_death
					target = scope:target
				}
				has_opinion_modifier = {
					modifier = abandoned_me_opinion
					target = scope:target
				}
				has_opinion_modifier = {
					modifier = reason_child_died
					target = scope:target
				}
				has_opinion_modifier = {
					modifier = falsely_accused
					target = scope:target
				}
			}
		}
		add = {
			value = ai_vengefulness
			multiply = 2
		}
		desc = SCHEME_I_MUST_TAKE_VENGEANCE
	}
	## Cowardice
	modifier = {
		trigger = { ai_boldness < 0 }
		add = ai_boldness
		desc = SCHEME_I_AM_A_COWARD
	}
	modifier = {
		trigger = { ai_boldness > 0 }
		add = ai_boldness
		desc = SCHEME_I_AM_BOLD
	}
	# Realm Drama
	## Scope:target spouse has caused internal strife in the realm
	character_hates_scope_spouse_due_to_strife_plus_desc_modifier = { TARGET = scope:target }
	## Family Feud
	house_feud_hostile_scheme_agent_modifier = yes
	modifier = {
		trigger = {
			exists = house.house_head
			exists = scope:target.house
			house.house_head = {
				any_owned_story = {
					story_type = story_cycle_house_feud
					exists = var:house_feud_house
					var:house_feud_house = scope:target.house
				}
			}
		}
		add = {
			value = 50
		}
		desc = SCHEME_TARGET_IS_FEUD_TARGET
	}
	# Other
	## Nothing to be gained for the prospective agent
	modifier = {
		trigger = {
			NAND = { # Greedy agents find that Gold is, indeed, something they stand to gain!
				OR = {
					AND = {
						exists = scope:gift
						always = scope:gift
					}
					AND = {
						exists = scope:gift_significant
						always = scope:gift_significant
					}
				}
				ai_greed > 0
			}
			NOR = {
				scope:target = {
					is_ruler = yes
					any_held_title = {
						place_in_line_of_succession = {
							target = root
							value <=10
						}
					}
				}
				opinion = {
					target = scope:target
					value <= medium_negative_opinion
				}
			}
			NAND = {
				exists = house.house_head
				exists = scope:target.house
				house.house_head = {
					any_owned_story = {
						story_type = story_cycle_house_feud
						exists = var:house_feud_house
						var:house_feud_house = scope:target.house
					}
				}
			}
		}
		add = {
			value = -10
			if = {
				limit = {
					ai_greed > 0
				}
				subtract = {
					value = ai_greed
					multiply = 0.25
				}
			}
		}
		desc = SCHEME_NOTHING_TO_GAIN
	}
}